<%--
  Created by IntelliJ IDEA.
  User: ChadZhao
  Date: 12-2-4
  Time: 下午5:41
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
<head>
    <title>新建合集</title>

    <style type="text/css">
        <!--
        body,td,th {
            font-size: 14px;
            color: #666666;
        }
        .form { width:99%; padding:5px;}
        .form th { text-align:right; font-weight:bold; padding:5px;}
        .form td { text-align:left; padding:5px;}
        .listinput { border:1px solid #ccc; padding:3px; background-image:url(<c:url value='/images/listinputbg.gif'/>); width:200px;height:24px;}
        .select1  { border:1px solid #ccc; padding:3px;}
        .button { background-image:url(<c:url value='/images/butbg.gif'/>); height:30px; line-height:30px; color:#FFFFFF; font-weight:bold; border:0px; cursor:hand;}
        .form_processbar{vertical-align:middle;position:relative;display:inline-block;*display:inline;*zoom:1;overflow:hidden;-moz-user-select:none;-webkit-user-select:none;}
        .form_processbar .process{position:relative;z-index:1;overflow:hidden;background:url(<c:url value='/images/yesin.jpg'/>);height:23px;overflow:hidden;}
        .form_processbar .percent{position:relative;top:-18px;z-index:2;width:100%;height:16px;overflow:hidden;line-height:16px;text-align:center;color:#555;font-size:14px;}
        .line { position:relative;padding:8px 0}
        .line span { float:left}
        .file { position:absolute; left:90px; top:8px; display:none;filter:alpha(opacity=0);opacity:0}
        .file1 { height:25px;width:35px; display:block; float:left;background-image:url(<c:url value='/images/index_14.jpg'/>); z-index:1; margin-left:5px; vertical-align:middle; cursor: pointer}
        .inputstyle { width:180px;height:25px; border:1px solid #888; z-index:99;background-image:url(<c:url value='/images/listinputbg.gif'/>);}
        -->
    </style>
</head>
<body>
    <table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><div style='float:left'> <img height="14" src="<c:url value='/frame/book1.gif'/>" width="20" />&nbsp;新建合集 </div>
      <div style='float:right;padding-right:8px;'>
        <!--  //保留接口  -->
      </div></td>
  </tr>
  <tr>
    <td height="1" background="<c:url value='/frame/sp_bg.gif'/>" style='padding:0px'></td>
  </tr>
</table>
    <form method="post" enctype="multipart/form-data">

    <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0" style="margin-top: 15px;">
  <tr>
    <td align="center" id="fileinfotd">
    <table border="0" cellpadding="0" cellspacing="0" class="form" style="margin-left: auto;margin-right: auto;width:65%;border:1px solid #CACACA;">
        <tr style="height:46px;">
            <td style="text-align: right;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">名称：</span>
            </td>
            <td align="left">
                <s:textfield theme="simple" name="articleTitle" id="articleTitle" cssClass="listinput" cssStyle="width:350px;"/>
            </td>
        </tr>
        <tr style="height:46px;">
            <td style="text-align: right;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">是否合集：</span>
            </td>
            <td align="left">
                <input type="radio" name="collectFlag" id="collectFlag1" value="1" onclick="changePage()"/>是合集
                <input type="radio" name="collectFlag" id="collectFlag0" value="0" onclick="changePage()"/>不是合集
            </td>
        </tr>
        <tr style="height:46px;">
            <td style="text-align: right;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">文件类型：</span>
            </td>
            <td align="left"><s:select name="videoAudioFlag" id="videoAudioFlag" theme="simple" cssClass="select1"
                list="#{'1':'视频','2':'音频'}"/>
            </td>
        </tr>
        <tr style="height:46px;" id="fileTr">
            <td style="width:130px;text-align: right;font-size: 14px;font-weight: bold;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">上传文件：</span>
            </td>
            <td align="left">
                <input type="file" name="uploads" onchange="hidImgInput()" class="listinput" style="width:300px;" id="uploadfile"/>
            </td>
        </tr>
        <tr style="height:130px;">
            <td style="text-align: right;">
                <span style="font-size: 14px;font-weight: bold;">简介：</span>
            </td>
            <td align="left">
                <s:textarea theme="simple" rows="8" cols="40" name="contextArea" id="contextArea" onblur="cutword(this,500)"/>
            </td>
        </tr>
        <tr style="height:46px;" id="imguptr">
            <td style="text-align: right;">
                <span style="color:#FF0000;"></span>&nbsp;<span style="font-size: 14px;font-weight: bold;">封面图：</span>
            </td>
            <td align="left">
                <input type="file" name="uploads" class="listinput" style="width:300px;" id="imgFile"/>
            </td>
        </tr>
        <tr style="height:96px;">
            <td style="text-align: right;">
                <span style="color:#FF0000;">*</span>&nbsp;<span style="font-size: 14px;font-weight: bold;">所属版块：</span>
            </td>
            <td align="left">
                <input type="checkbox" name="articleType" id="articleType34" value="34"/>工作视频
                <input type="checkbox" name="articleType" id="articleType35" value="35"/>教育讲座
                <input type="checkbox" name="articleType" id="articleType36" value="36"/>税官风采<br>
                <input type="checkbox" name="articleType" id="articleType37" value="37"/>反腐警示
                <input type="checkbox" name="articleType" id="articleType31" value="31"/>动漫集锦
                <input type="checkbox" name="articleType" id="articleType32" value="32"/>经典红歌
                <input type="checkbox" name="articleType" id="articleType33" value="33"/>红色电影
            </td>
        </tr>
        <tr style="height:120px;">
            <td colspan="2" style="text-align: center;">
                <button type="button" class="button" id="savebt" style="width:50px;" onclick="dosave()">保存</button>&nbsp;
                <button type="button" class="button" style="width:50px;" onclick="location.href='<c:url value='/system/toVideoManage.do'/>'">返回</button>
            </td>
        </tr>
    </table>
        <s:hidden name="articleId"/>
        <s:hidden name="partType"/>
        <input type="hidden" name="detailId" id="detailId"/>
        <input type="hidden" name="filedeType" id="filedeType"/>
        <input type="hidden" name="imgFlag" id="imgFlag"/>
    </td>
  </tr>
</table>
    </form>
<iframe name="hidframe1" id="hidframe1" frameborder="0" style="display: none;" src="javascript:void(0);"></iframe>
</body>
<script>
    parent._setHeight();

    function dosave(){
        var collStr = "";
        if (document.getElementById("articleTitle").value == "") {
            alert("请输入名称！");
            return;
        }
        if(document.getElementById("collectFlag1").checked) {
            collStr = "合集";
        } else if(document.getElementById("collectFlag0").checked) {
            collStr = "";
        } else {
            alert("请选择是否合集！");
            return;
        }
        if(document.getElementById("collectFlag0").checked) {
            var filep = document.getElementById("uploadfile").value;
            if(filep == "") {
                alert("请选择需要上传的文件！");
                return;
            }
            var filety = filep.substring(filep.lastIndexOf("."),filep.length);
            if (document.getElementById("videoAudioFlag").value == "1") {
                var allowType = ".flv,.swf,";
                if(allowType.indexOf(filety+",")<0) {
                    alert("本系统仅支持FLV/SWF格式的视频！");
                    return;
                }
            } else {
                var allowType = ".mp3,";
                if(allowType.indexOf(filety+",")<0) {
                    alert("本系统仅支持MP3格式的音频！");
                    return;
                }
            }
        }
        var haveCheck = false;
        for (var a = 0; a < document.all.articleType.length; a ++) {
            if (document.all.articleType[a].checked) {
                haveCheck = true;
            }
        }
        if (!haveCheck) {
            alert("请选择所属版块！");
            return;
        }
        var mess = "您确定保存该音频"+collStr+"吗？";
        if (document.getElementById("videoAudioFlag").value=="1") {
            if (document.getElementById("imgFile").value=="") {
                alert("请选择该视频"+collStr+"的封面图！");
                return;
            }
            mess = "您确定保存该视频"+collStr+"吗？";
        }
        if(document.getElementById("contextArea").value == "") mess = "您没有录入简介，确定保存吗？";
        if(!confirm(mess)) {
            return;
        }
        document.getElementById("savebt").disabled = true;
        document.forms[0].action="<c:url value='/system/saveVideoMainInfo.do'/>";
        document.forms[0].submit();
    }

    function changePage() {
        if(document.getElementById("collectFlag1").checked) {
            document.getElementById("fileTr").style.display = "none";
        } else if(document.getElementById("collectFlag0").checked) {
            document.getElementById("fileTr").style.display = "block";
        }
    }

    function cutword(obj,leng) {
        var summ = obj.value;
        if(summ.length > leng) {
            obj.value = summ.substring(0,leng);
        }
    }

    function hidDiv() {
        document.getElementById("upfilediv").style.height = 0;
        document.getElementById("upfilediv").style.width = 0;
        document.getElementById("upfilediv").style.display = "none";
    }
</script>
</html>